$(document).ready(function(){
  list();
})

function list(){
  $.ajax({
    url : "/leave/list_student",
    dataType : "json", 
    success : function(resp){
      if(resp){
        insertDatas(resp);
      }
    }
  })
}

function insertDatas(datas){
  var html = "";
  for(var i in datas){
    var data = datas[i];
    html += "<div>";
    html += "<table class='am-table am-table-compact am-table-bordered am-table-striped'>";
    html += "<tbody>";
    html += "<tr class='serial'><td>流水号</td><td>" + data.id + "</td></tr>"; 
    html += "<tr><td>提交时间</td><td>" + data.create_date + "</td></tr>"; 
    html += "<tr><td>开始时间</td><td>" + data.begin_date + "</td></tr>"; 
    html += "<tr><td>结束时间</td><td>" + data.end_date + "</td></tr>"; 
    html += "<tr><td>请假类型</td><td>" + data.leave_desc + "</td></tr>";
    html += "<tr><td>请假事由</td><td>" + data.reson + "</td></tr>";
    html += "<tr><td>请假状态</td><td>" + data.status_desc + "</td></tr>";
    html += "<tr><td>审核人1</td><td>" + data.verify_name + "</td></tr>";
    html += "<tr><td>审核时间1</td><td>" + data.verify_date + "</td></tr>";
    html += "<tr><td>审核备注1</td><td>" + data.verify_comment + "</td></tr>";
    html += "<tr><td>审核人2</td><td>" + data.verify_name2 + "</td></tr>";
    html += "<tr><td>审核时间2</td><td>" + data.verify_date2 + "</td></tr>";
    html += "<tr><td>审核备注2</td><td>" + data.verify_comment2 + "</td></tr>";
    html += "</tbody>";
    html += "</table>";
    html += "</div>";
    html += "<hr data-am-widget='divider' class='am-divider am-divider-default' />";
  }
  $("#content").html(html);
}

// <div>
//       <table class="am-table am-table-compact am-table-bordered am-table-striped">
//         <tbody>
//           <tr class="serial">
//             <td>流水号</td>
//             <td>1</td>
//           </tr>
//           <tr>
//             <td>请假时间</td>
//             <td>2017-06-21 17:03:01</td>
//           </tr>
//           <tr>
//             <td>开始时间</td>
//             <td>2017-03-28 02:10</td>
//           </tr>
//           <tr>
//             <td>结束时间</td>
//             <td>2017-03-31 02:10</td>
//           </tr>
//         </tbody>        
//       </table>
//     </div>
//     {% include "bottom.html" %}
//   </div>
